<div class="cont">
    <div class="position">
        <img alt="位置图标" src="dist/images/position.png" />营销管理>渠道管理
        <a ng-click="openDetail()" ng-hide="$needClientCache" title="打开新窗口查看"><i class="large External icon"></i></a>
    </div>
    <div class="mybackground">
        <div class="cont_fr_top">
            <div class="cont_fr_btn">
                <div style="height: 20px;">
                    <div class="fr">
                        <button class="clear_btn" ng-click="addSource()" >添加渠道</button>
                    </div>
                </div>
            </div>
            <div class="menus" >
                <div class="menus_con ui form">
                    <div class="four fields">
                        <div class="inline field">
                            <label>渠道名称</label>
                            <input type="text" placeholder="渠道名称" ng-model="search_param.name" ng-keyup="$event.keyCode == 13 && sourceDataList()" style="width: 160px">
                        </div>
                        <div class="inline field">
                            <label>归属分公司</label>
                            <select ng-model="search_param.company" class="ui dropdown" ng-keyup="$event.keyCode == 13 && sourceDataList()" style="width: 160px" >
                                <option value="-1" ng-selected="1">全部</option>
                                <option ng-repeat="x in sectorlist" value="{{x.sector_id}}">{{x.sector_name}}</option>
                            </select>
                        </div>
                    </div>
                    <div class=" fields">
                        <div class="inline field">
                            <button class="clear_btn" ng-click="sourceDataList()" style="margin-left: 4.5em"> 查找</button>
                        </div>
                    </div>
                  </div>
                </div>
            </div>
        </div>
        <div class="menus">
            <div class="menus_table">
                <table class="ui celled yellow striped table">
                    <thead>
                        <tr>
                            <th>渠道名称</th>
                            <th>归属分公司</th>
                            <th>备注信息</th>
                            <th>最后更新时间</th>
                            <th style="text-align:center" >操作</th>
                        </tr>
                    </thead>
                    <tbody ng-show="sourcepage.pageAll >= 1">
                        <tr ng-repeat=" sou in source ">
                            <td>{{sou.name}}</td>
                            <td>{{sou.company}}</td>
                            <td>{{sou.remark}}</td>
                            <td>{{sou.update_time}}</td>
                            <td style="text-align:center">
                                <a href="javascript:;" title="编辑渠道信息"  ng-click="editSourceBox(sou['source_id'])">
                                   编辑
                                </a>
                                <a href="javascript:;" title="删除渠道信息" ng-click="delSource(sou['source_id'])">
                                   删除
                                </a>
                            </td>
                        </tr>
                    </tbody>
                    <tr>
                        <td colspan="5"  ng-show="sourcepage.pageAll < 1">
                            <p class="null_data">没有找到数据~~~</p>
                        </td>
                    </tr>
            </table>
            <div class="ui pagination menu fr"  ng-show="sourcepage.pageAll > 1" class="ui borderless pagination menu"  jspagination  page-object="sourcepage" page-func="sourceDataList"></div>
            </div>
        </div>
    </div>
    <!--内容区结束-->

 <!-- 系统信息弹出层 is ending here-->
<div class="ui systemerror modal transition ">
    <div class="header_h4 ">系统提示</div>
    <div class="content ">
        <div class="inline fluid fields ">
            <div class="field " style="display: inline-block;width: 5%; " ng-show="sourcercode == 1 ">
                <i class="thumbs up large icon "></i>
            </div>
            <div class="field " style="display: inline-block;width: 5%; " ng-show="sourcercode == 0 ">
                <i class="thumbs down large icon "></i>
            </div>
            <div class="field " style="display: inline-block; ">
                <p>{{sourcerMsg}}</p>
            </div>
        </div>
        <div class="actions " style="padding:14px; ">
            <div class="center " style="margin-bottom:10px; ">
                <div class="ui pop_btn_qx negative ">关闭</div>
            </div>
        </div>
    </div>
</div>
<!-- 系统信息弹出层 is ending here-->

 <!-- 表单开始 -->
<div class="ui add modal">
    <i class="close icon"></i>
    <div class="header_h4"> 添加渠道 </div>
    <div class="content">
        <div class="ui form">
            <form name="formRole" class="ui fluid form " id="ChannalID">
                <div class="fields">
                    <div class="five wide field required">
                        <label class="label_fl">渠道名称</label>
                        <input type="text" placeholder="渠道名称" name="name" ng-model="add_data.name" style="width:160px;height:32px" />
                    </div>
                    <div class="three wide field"></div>
                    <div class="five wide field ">
                      <label class="label_fl">归属范围</label>
                      <div class="ui left icon input" style="width: 160px;">
                            <select name="add_parent" style="width:100%;display:inline-block;" ng-model="add_data.sub_company" class="ui dropdown">
                                <option value="">归属分公司</option>
                                <option ng-repeat="sec in sectorlist" value="{{sec.sector_id}}">{{sec.sector_name}}</option>
                            </select>
                      </div>
                    </div>
                </div>
                <div class="ui row">
                    <label>备注信息:</label>
                    <div class="field">
                        <textarea id="info" ng-model="add_data.remark"  placeholder="备注信息" style="width:100%;"></textarea>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="actions">
        <div class="ui green button positive">确定</div>
        <div class="ui grey button negative">取消</div>
    </div>
</div>
<div class="ui edit modal">
   <i class="close icon"></i>
    <div class="header_h4">
   渠道编辑
  </div>
    <div class="content">
        <div class="ui form">
        <form name="formRole" class="ui fluid form " id="ChannalEdit">
            <div class="fields">
                <div class="five wide field ">
                    <label class="label_fl">渠道名称</label>
                    <input type="text" placeholder="渠道名称" name="edit_name" style="width:160px;height:32px;"  ng-model="editData.name"/>
                </div>
                <div class="three wide field"></div>
                <div class="five wide field ">
                  <label class="label_fl">归属分公司</label>
                  <div class="ui left icon input" style="width: 160px;">
                    <select name="edit_parent" ng-model="editData.sub_company" class="dropdown"  >
                        <option ng-repeat="sec in sectorlist"  ng-selected="editData.sub_company==sec.sector_id" value="{{sec.sector_id}}">{{sec.sector_name}}</option>
                    </select>
                  </div>
                </div>
            </div>
            <div class="ui row">
                <label>备注信息:</label>
                <div class="field">
                    <textarea  name="edit_info" placeholder="备注信息" style="width:100%;" ng-model="editData.remark"></textarea>
                </div>
            </div>
        </form>
        </div>
    </div>
    <div class="actions">
        <div class="ui green button positive">确定</div>
        <div class="ui grey button negative">取消</div>
    </div>
</div>
<!--成功弹窗-->
<div class="ui small modal modal1 time" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">{{Msg}}成功</p>
    </div>
</div>
<!--添加失败-->
<div class="ui modal modal2 time" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge red warning outline icon"></i>
        <p style="padding-top: 15px;">{{Msg}}失败</p>
    </div>
</div>

<div class="ui small del modal transition" style="text-align: center;">
    <div class="header">删除渠道信息</div>
    <div class="content">
        <i class="huge blue help circle icon"></i>
        <p style="padding-top: 15px;">删除渠道信息确认?</p>
    </div>
    <div class="actions" style="text-align: center;">
      <div class="ui positive button" ng-click="cancel(remind_id)">确认</div>
      <div class="ui grey negative button ">取消</div>
    </div>
</div>

<!--delete source records-->
<!-- <div class="ui small del modal transition"  id="del-model" >
    <div class="header">
        删除渠道信息确认？
    </div>
    <div class="content">
        <p></p>
    </div>
    <div class="actions">
        <div class="center">
            <div class="ui pop_btn_qd positive">确定</div>
            <div class="ui pop_btn_qx negative">取消</div>
        </div>

    </div>
  </div> -->
<!-- 表单结束 -->
<script type="text/javascript">
    $(function(){
        $('.ui.dropdown').dropdown();
        $('#ChannalID').form({
            on: 'blur',
            inline : true,
            fields: {
                add_name: {
                    identifier: 'name',
                    rules: [
                        {
                            type   : 'empty',
                            prompt : '渠道名称不能为空'
                        }
                    ]},
                info:{
                    identifier: 'note',
                    rules: [
                        {
                            type   : 'empty',
                            prompt : '备注信息不能为空'
                        }
                    ]}

            }});
        $('#ChannalEdit').form({
            on: 'blur',
            inline : true,
            fields: {
                edit_name: {
                    identifier: 'edit_name',
                    rules: [
                        {
                            type   : 'empty',
                            prompt : '渠道名称不能为空'
                        }
                    ]},
                edit_info:{
                    identifier: 'edit_info',
                    rules: [
                        {
                            type   : 'empty',
                            prompt : '备注信息不能为空'
                        }
                    ]}
            }});
    });

</script>